﻿namespace UnityEditor.Graphs.AnimationStateMachine
{
    using System;
    using UnityEditor;
    using UnityEngine;

    [CustomEditor(typeof(AnyStateNode))]
    internal class AnyStateNodeInspector : Editor
    {
        private StateTransitionsEditor m_StateTransitionsEditor;

        private void Init()
        {
            if (this.m_StateTransitionsEditor == null)
            {
                this.m_StateTransitionsEditor = new StateTransitionsEditor(null, this);
            }
        }

        public void OnDestroy()
        {
            this.m_StateTransitionsEditor.OnDestroy();
        }

        public void OnDisable()
        {
            this.m_StateTransitionsEditor.OnDisable();
        }

        public void OnEnable()
        {
            this.Init();
            this.m_StateTransitionsEditor.OnEnable();
        }

        public override void OnInspectorGUI()
        {
            this.Init();
            GUI.enabled = true;
            this.m_StateTransitionsEditor.OnInspectorGUI();
        }
    }
}

